package cn.vc.content.entity.video;

import cn.vc.basicmodule.entity.Entity;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;

import java.util.List;

/**
 * 视频历史
 */
@Data
public class VideoHistory extends Entity {
    private Long userId; // 所属用户ID
    private String videoIds; // 历史视频ID数组的JSON
    private Long videoNum; // 历史记录数量
    @TableField(exist = false)
    private List<Long> videoIdList; // 历史视频ID数组

    public void setVideoIds(String videoIds) {
        this.videoIds = videoIds;
        this.videoIdList = JSON.parseArray(videoIds, Long.class);
    }

    public void setVideoIdList(List<Long> videoIdList) {
        this.videoIdList = videoIdList;
        this.videoIds = JSON.toJSONString(videoIdList);
    }
}
